module game {
	/**
	 * 页面5
	 * @author caizj 2015-08-12
	 *
	 */
	export class SwiperPage5 extends BaseSwiper{
        private bg: egret.Bitmap;//背景
        private game_logo: egret.Bitmap;//游戏logo
        private game_slogan: egret.Bitmap;//游戏slogan
                        
        public constructor() {
            super();
        }
                        
        public activate(): void { 
            if(this.isActive) return;
                                    
            super.activate();
//            console.log("激活page3");
            if(this.bg == null) { 
                this.bg = this.createBitmapByName("page5_bg_png");
                this.addChild(this.bg);
                this.bg.x = this.bg.y = 0;
            }
            if(this.game_logo == null) { 
                this.game_logo = this.createBitmapByName("page5_logo");
                this.addChild(this.game_logo);           
            }
            if(this.game_slogan == null) { 
                this.game_slogan = this.createBitmapByName("page5_slogan");
                this.addChild(this.game_slogan);           
            }
            //淡入
            this.game_logo.x =-240;
            this.game_logo.y = 0;
            this.game_logo.visible = true;
            this.game_logo.alpha = 0;
                        
            //重磅弹出
            this.game_slogan.x =0;
            this.game_slogan.y = 0;
            this.game_slogan.visible = false;
            this.game_slogan.anchorX = 0.5;//中心点
            this.game_slogan.anchorY = 0.5;
            this.game_slogan.x = 320;
            this.game_slogan.y = 504;
            this.game_slogan.scaleX = this.game_slogan.scaleY = 0.2;
                                 
            //入场动画  
            //淡入 
            egret.Tween.get(this.game_logo).to({alpha:1, x:0}, 300, egret.Ease.quintOut).call(this.onTweenOver, this,[this.game_logo]);
            
            //重磅弹出
            egret.Tween.get(this.game_slogan).wait(300).to({scaleX:1, scaleY:1}, 500,egret.Ease.bounceOut).call(this.onTweenOver, this, [this.game_slogan]); 
                                  
            //播放入场音效
//            this.playSound();
        }
                        
        public deactivate(): void { 
            if(!this.isActive) return;
                                                
            super.deactivate();
//            console.log("静止page1");
                                    
            if(this.bg == null) { 
                this.bg = this.createBitmapByName("page5_bg_png");
                this.addChild(this.bg);
            }
            if(this.game_logo) { 
                this.game_logo.visible = false;
            }
            if(this.game_slogan) { 
                this.game_slogan.visible = false;
            }
        }
        
        protected onTweenOver(obj:any): void {
            super.onTweenOver(obj);
                                                            
            //logo动画结束后，显示文字图片
            if(obj == this.game_logo) {  
                    this.game_slogan.visible = true;           
            }
        }
	}
}
